/**
 * Copyright 2018 by FREEMYPAL.
 * Tianhua Information Technology Park (South) Building 4, 4th Floor, Longtian Road 195,Shanghai, P.R. China，200235. 
 * All rights reserved.
 * This software is the confidential and proprietary information of FREEMYPAL
 * ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with FREEMYPAL.
 */
package com.roc.web.action.auditStatistics;

import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;

/**
 * @Description: (这里用一句话描述这个类的作用)
 * @author JunFei.Zhao
 * @version 1.0 2018年3月6日
 */
public class AuditStatisticsSearchCondition extends BaseSearchCondition {

	private static final long serialVersionUID = 1L;
	private String auditDate;  // 开始时间

	// 统计
	@Override
	protected String getRowCountHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append(" SELECT COUNT( Distinct t.operators)  "
			    + "	FROM apsmgm.t_auditing_item  t  WHERE to_char(t.dt_create, 'YYYYMMDD') = '"+auditDate+"' AND  t.audit_code = '7001' ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("SELECT  "
						+ "t.operators,"
						+" (SELECT  count(1)  from apsmgm.t_dypay_operators_receive r where to_char(r.create_at, 'YYYYMMDD') = '"+auditDate+"'"
								+" AND r.op_accountno=t.operators ) 领取数量,"
						+" SUM (DECODE(result_code,'01',countNum,0)) 通过数量,"
						+" SUM (DECODE(result_code,'02',countNum,0)) 驳回数量,"
						+" SUM (DECODE(result_code,'03',countNum,0)) 限制数量,"
						+" SUM (DECODE(result_code,'04',countNum,0)) 解限数量 "
						+ "FROM "
								+"( SELECT b.operators,b.result_code,count(b.result_code) countNum"
								+" FROM apsmgm.t_auditing_item  b WHERE b.audit_code = '7001'"
								+" AND  to_char(b.dt_create, 'YYYYMMDD') = '"+auditDate+"' GROUP BY b.operators,b.result_code ) t   "
						+ "GROUP BY t.operators");

		return sb.toString();
	}
	
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		return null;
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return null;
	}

	public String getAuditDate() {
		return auditDate;
	}

	public void setAuditDate(String auditDate) {
		this.auditDate = auditDate;
	}


}
